BIN = iu_wiretap 
SRC := $(wildcard ./src/*.cpp)
DEPS:= $(wildcard ./src/*.h)
OBJ := $(patsubst %cpp,%o,$(wildcard ./src/*.cpp))
HEADEROBJ:=$(patsubst %cpp,%o,$(wildcard ./src/*Header.cpp))

TESTBIN = iu_wiretap_test
TESTSRC:=$(wildcard ./tests/*.cpp)
TESTDEPS:=$(wildcard ./tests/*.h)
TESTOBJ:=$(patsubst %cpp,%o,$(wildcard ./tests/*.cpp))

CFLAGS = -g -Wall -fprofile-arcs -ftest-coverage 
FMT = -linux

%.o: %.cpp $(DEPS)
	$(CXX) $(CFLAGS) -c -o $@ $<

all: $(BIN) test Doxyfile html/index.html

$(BIN): $(OBJ)
	$(CXX) $(CFLAGS) -o $@ $^  -lpcap

test: $(TESTBIN)
	
$(TESTBIN): $(TESTOBJ) $(HEADEROBJ)
	$(CXX) $(CFLAGS) -lpcap -o $@ $^ 
	
Doxyfile:
	doxygen -s -g -   > $@
	echo QUIET = YES >> $@
	@#Nah.  Shorter is better.
	echo QUIET = YES  > $@
	echo 'PROJECT_NAME = "Wire Tap"' >> $@
	echo GENERATE_TREEVIEW = YES     >> $@
	echo VERBATIM_HEADERS  = NO      >> $@
	
html/index.html:	Doxyfile $(OBJ)
	doxygen

clean:
	rm -f $(OBJ) $(BIN) *.gcno *.gcda *.gcov TAGS
	rm -f src/*.g*
	rm -f test/*.g*
	rm -f $(TESTOBJ) $(TESTBIN)
    
